package com.realgodo.site.service.dic;

import java.util.List;

import org.hibernate.Criteria;
import org.hibernate.SessionFactory;
import org.hibernate.criterion.Restrictions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springside.modules.orm.hibernate.DefaultEntityManager;

import com.realgodo.site.entity.dic.ConstellationBlood;

@Service
@Transactional
public class ConstellationBloodManager extends DefaultEntityManager<ConstellationBlood, Long> {

	@Autowired
	protected SessionFactory sessionFactory;
	
	@SuppressWarnings("unchecked")
	public List<ConstellationBlood> getConstellationBloods(Long constellationId){
		Criteria c = sessionFactory.getCurrentSession().createCriteria(ConstellationBlood.class);
		c.add(Restrictions.eq("constellation.id", constellationId));
		return c.list();
	}
}
